emes.tex (2315B)
1 \begin{tikzpicture}[ 2 word after/.style={right=0.9mm of #1, inner sep=0}, 3 token after/.style={right=0mm of #1, inner sep=0}, 4 vector/.style={draw, anchor=south, rectangle, minimum width=1.5mm, inner sep=0mm, minimum height=6mm}, 5 row vector/.style={vector, minimum height=1.5mm, minimum width=6mm}, 6 baseline=(fmid.north), 7 ] 8 \node[inner sep=0] (cls) {\strut \textsc{cls}}; 9 \node[word after=cls] (be1) {\strut \texttt{<e1>}}; 10 \node[word after=be1] (jeremy) {\strut Jeremy}; 11 \node[word after=jeremy] (ben) {\strut Ben}; 12 \node[token after=ben] (tham) {\strut tham}; 13 \node[word after=tham] (ee1) {\strut \texttt{</e1>}}; 14 \node[word after=ee1] (was) {\strut was}; 15 \node[word after=was] (born) {\strut born}; 16 \node[word after=born] (in) {\strut in}; 17 \node[word after=in] (be2) {\strut \texttt{<e2>}}; 18 \node[word after=be2] (london) {\strut London}; 19 \node[word after=london] (ee2) {\strut \texttt{</e2>}}; 20 \node[word after=ee2] (period) {\strut .}; 21 \node[word after=period] (eos) {\strut \textsc{eos}}; 22 23 \coordinate (bertsw) at ($(cls.north west) + (0,5mm)$); 24 \coordinate (bertne) at ($(eos.north east) + (0,15mm)$); 25 \node[draw, rectangle, inner sep=0mm, fit=(bertsw) (bertne)] (bert) {}; 26 \node[anchor=center] at (bert.center) {\large\textsc{bert}}; 27 28 \foreach \w/\focus in { 29 cls/\transparencyDefault, 30 be1/1, 31 jeremy/\transparencyDefault, 32 ben/\transparencyDefault, 33 tham/\transparencyDefault, 34 ee1/\transparencyDefault, 35 was/\transparencyDefault, 36 born/\transparencyDefault, 37 in/\transparencyDefault, 38 be2/1, 39 london/\transparencyDefault, 40 ee2/\transparencyDefault, 41 period/\transparencyDefault, 42 eos/\transparencyDefault 43 }{ 44 \begin{scope}[opacity=\focus] 45 \node[vector] (v\w) at ($(\w.north) + (0, 2cm)$) {}; 46 \draw[arrow] (\w) -- (\w|-bert.south); 47 \draw[arrow] (\w|-bert.north) -- (v\w); 48 \end{scope} 49 } 50 51 \coordinate (outy) at ($(vbe1.north)!0.5!(vbe2.north)$); 52 \coordinate (outp) at (outy-|bert); 53 \coordinate (fmid) at ($(outp) + (0, 1.5mm)$); 54 55 \node[row vector,anchor=east] (re1) at ($(outp) + (0, 5mm)$) {}; 56 \node[row vector,right=0mm of re1] (re2) {}; 57 58 \draw[arrow,rounded corners=1mm] (vbe1) -- (vbe1|-fmid) -- (re1|-fmid) -- (re1); 59 \draw[arrow,rounded corners=1mm] (vbe2) -- (vbe2|-fmid) -- (re2|-fmid) -- (re2); 60 \end{tikzpicture}